<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="div">div1</div>
    <script>
        let object = {name:"奉先",age: 35};
        let {name,age} = object;
        console.log("name = ",name); // 奉先
        console.log("age = ",age); // 35

        // 对象解构赋值，是按照对象的属性名来获取
        let {n,a} = object;
        console.log("n = ",n); // undefined
        console.log("a = ",a); // undefined

        // 结构赋值，可以用其它变量名来获取原有对象的属性
        let {name: n1,age: a1} = object;
        console.log("n1 = ",n1);
        console.log("a1 = ",a1);


        let object2 = {user1: "feng",user2: "yuan"}
        let {user1} = object2;
        console.log("user1 = ",user1);
        
    </script>
</body>
</html>